home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1033 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. From: Nico Josuttis <nico@bredex.de>
  2. Message-ID: <199604110801.KAA01575@bredex.bredex.de>
  3. X-Original-Date: Thu, 11 Apr 1996 10:01:04 +0200
  4. Path: in1.uu.net!bounce-back
  5. Date: 11 Apr 96 08:09:01 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: strings as stl container
  9. References: <199604020907.LAA06972@bredex.bredex.de> <4jvdnd$c9c@hermes.synopsys.com>
  10. Reply-To: nico@bredex.de
  11. Organization: Bredex GmbH
  12. Apparently-To: jbuck@Synopsys.COM
  13. Apparently-To: nico@bredex.de
  14. Apparently-To: std-c++@ncar.ucar.edu
  15. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  16.     iQBFAgUBMWy+NeEDnX0m9pzZAQGkeQGAlPR/cGRi4lqz5gIniGqw6ElZgh1/lf7O
  17.     iS5ylgOsRVjzo2shwsAmXJce9p0ux2xV
  18.     =9l/g
  19.  
  20. In article <4jvdnd$c9c@hermes.synopsys.com>,
  21. Joe Buck <jbuck@Synopsys.COM> wrote:
  22. >Nico Josuttis <nico@bredex.de> writes:
  23. >>Due to the fact that strings have iterator support,
  24. >>the could be used as stl container.
  25. >
  26. >Correct.
  27. >
  28. >>But two things are missing:
  29. >> - push_back()
  30. >> - clear()
  31. >
  32. >No, these are not needed.
  33. clear() is required for sequenceable containers,
  34. push_back() is optional for sequenceable containers but would make
  35. many sense.
  36. So for the others vector like operations
  37. (pop_back(), front(), back()).
  38.  
  39. >
  40. >>These are fundamental operations, that the corresponding "normal"
  41. >>container, namely vector, has.
  42. >
  43. >The documentation I have does not list clear as a member of vector.
  44. >
  45. Oh yes, it does, see 23.2.5.6 in vector class structure.
  46.  
  47. >>Especially push_back() would be essential to use insert iterators
  48. >>for strings.
  49. >
  50. >No, this isn't true.  You need push_back to use back_insert_iterator,
  51. >but insert_iterator only needs insert, which string does have.
  52. >
  53. But insert_iterators are VERY dangerous for sequenceable collections.
  54. They invalidate themself if the position parameter is not end().
  55. So having push_back() would be safer and of course more convenient
  56. (otherwise there is no sense to have it for vectors either).
  57.  
  58. -- 
  59. Nico                             address: BREDEX GmbH, Nicolai Josuttis
  60. email:   nico@bredex.de                   Fallersleber-Tor-Wall 23
  61. phone:   +49 531 24330-0                  D-38100 Braunschweig
  62. fax:     +49 531 24330-99                 Germany
  63. ---
  64. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  65. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  66. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  67. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  68. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  69.